using System;
using System.Collections.Generic;
using BBX.Common;
using BBX.Entity;
using BBX.Forum;

namespace BBX.Web
{
    public class myposts : PageBase
    {
        public IList<Topic> topics;
        public Int32 pageid = DNTRequest.GetInt("page", 1);
        public Int32 pagecount;
        public Int32 topiccount;
        public String pagenumbers;
        public IUser user;

        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";
            if (userid == -1)
            {
                base.AddErrLine("你尚未登录");
                return;
            }
            user = Users.GetUserInfo(userid);
            //this.topiccount = Topics.GetTopicsCountbyUserId(this.userid, true);
            topiccount = MyPost.FindTidCountByUid(userid);
            pagecount = ((topiccount % 16 == 0) ? (topiccount / 16) : (topiccount / 16 + 1));
            pagecount = ((pagecount == 0) ? 1 : pagecount);
            pageid = ((pageid < 1) ? 1 : pageid);
            pageid = ((pageid > pagecount) ? pagecount : pageid);
            topics = Topics.GetTopicsByReplyUserId(userid, pageid, 16, 600, config.Hottopic);
            pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "myposts.aspx", 8);
        }
    }
}